#pragma once
#include<iostream>
#include<ctime>
namespace mymq{
#define DBG_LEVEL 0
#define ERR_LEVEL 1
#define INF_LEVEL 2
#define DEF_LEVEL DBG_LEVEL
#define LOG(lev_str,level,format,...) {\
    if(level>=DEF_LEVEL){\
    time_t t=time(nullptr);\
    struct tm* ptr = localtime(&t);\
    char t_str[32];\
    strftime(t_str,31,"%H:%M:%S",ptr);\
    printf("[%s][%s][%s:%d]" format "\n",lev_str,t_str,__FILE__,__LINE__,##__VA_ARGS__);\
    }\
}
#define DLOG(format,...) LOG("DBG",DBG_LEVEL,format,##__VA_ARGS__)
#define ELOG(format,...) LOG("ERR",ERR_LEVEL,format,##__VA_ARGS__)
#define ILOG(format,...) LOG("INF",INF_LEVEL,format,##__VA_ARGS__)
}
